DEFINITION Display;

IMPORT
  li := Lists,
  I := Intuition,
  u := Utility,
  g := Graphics,
  e := Exec;

TYPE
  DispEl = RECORD (li.Node) 
    title : e.STRPTR;
    rp : g.RastPortPtr;
    font : g.TextFontPtr;
    width : INTEGER;
    height : INTEGER;
    turtleX : REAL;
    turtleY : REAL;
    turtleDir : REAL;
    pen : BOOLEAN;
    cursor : BOOLEAN;
    curX : INTEGER;
    curY : INTEGER;
    curXAbs : INTEGER;
    curYAbs : INTEGER;
    txtWidth : INTEGER;
    txtHeight : INTEGER;
    gzz : BOOLEAN;
    left,top : INTEGER;
  END;
  Screen = RECORD (DispEl) 
    screen : I.ScreenPtr;
    backdrop : I.WindowPtr;
  END;
  Window = RECORD (DispEl) 
    window : I.WindowPtr;
  END;
  DispElPtr = POINTER TO DispEl;
  ScreenPtr = POINTER TO Screen;
  WindowPtr = POINTER TO Window;

CONST
  line = -1;
  dots = 5555H;
  bigdots = 3333H;
  broken = 0F0FH;

PROCEDURE OpenScreen(scrn: ScreenPtr; title: ARRAY OF CHAR; x, y, w, h: INTEGER; d: SHORTINT; hires, lace: BOOLEAN): BOOLEAN;
PROCEDURE OpenWindow(win: WindowPtr; title: ARRAY OF CHAR; x, y, w, h: INTEGER; screen: I.ScreenPtr): BOOLEAN;
PROCEDURE OpenWindowTags(win: WindowPtr; gadg: I.GadgetPtr; gzz: BOOLEAN; title: ARRAY OF CHAR; x, y, w, h: INTEGER; screen: I.ScreenPtr; activate: BOOLEAN; tags: sys.ADDRESS): BOOLEAN;
PROCEDURE OpenWindowX(win: WindowPtr; gadg: I.GadgetPtr; gzz: BOOLEAN; title: ARRAY OF CHAR; x, y, w, h: INTEGER; activate: BOOLEAN; screen: I.ScreenPtr): BOOLEAN;
PROCEDURE Close(d: DispElPtr);
PROCEDURE Init(d: DispElPtr);
PROCEDURE SetColors(s: ScreenPtr; VAR cols: ARRAY OF INTEGER);
PROCEDURE SetCol(s: ScreenPtr; num, R, G, B: INTEGER);
PROCEDURE NumToRGB(num: INTEGER; VAR r, g, b: INTEGER);
PROCEDURE RGBToNum(r, g, b: INTEGER): INTEGER;
PROCEDURE FrontPen(d: DispElPtr; pen: SHORTINT);
PROCEDURE BackPen(d: DispElPtr; pen: SHORTINT);
PROCEDURE Jam1(d: DispElPtr);
PROCEDURE Jam2(d: DispElPtr);
PROCEDURE Complement(d: DispElPtr);
PROCEDURE LinePattern(d: DispElPtr; pat: INTEGER);
PROCEDURE Clear(d: DispElPtr);
PROCEDURE Line(d: DispElPtr; x1, y1, x2, y2: INTEGER);
PROCEDURE Dot(d: DispElPtr; x, y: INTEGER);
PROCEDURE DotColor(d: DispElPtr; x, y: INTEGER): INTEGER;
PROCEDURE Rect(d: DispElPtr; x, y, w, h: INTEGER);
PROCEDURE Box(d: DispElPtr; x, y, w, h: INTEGER);
PROCEDURE Move(d: DispElPtr; x, y: INTEGER);
PROCEDURE Draw(d: DispElPtr; x, y: INTEGER);
PROCEDURE Text(d: DispElPtr; x, y: INTEGER; s: ARRAY OF CHAR);
PROCEDURE Circle(d: DispElPtr; x, y, r: INTEGER);
PROCEDURE Ellipse(d: DispElPtr; x, y, rx, ry: INTEGER);
PROCEDURE Font(d: DispElPtr; name: ARRAY OF CHAR; height: INTEGER): BOOLEAN;
PROCEDURE SetTurtlePos(d: DispElPtr; x, y: REAL);
PROCEDURE GetTurtlePos(d: DispElPtr; VAR x, y: REAL);
PROCEDURE SetTurtleDir(d: DispElPtr; dir: REAL);
PROCEDURE GetTurtleDir(d: DispElPtr): REAL;
PROCEDURE SetPen(d: DispElPtr);
PROCEDURE LiftPen(d: DispElPtr);
PROCEDURE Forward(d: DispElPtr; s: REAL);
PROCEDURE TurnLeft(d: DispElPtr; alpha: REAL);
PROCEDURE TurnRight(d: DispElPtr; alpha: REAL);
PROCEDURE SetCursor(d: DispElPtr; on: BOOLEAN): BOOLEAN;
PROCEDURE CursorOn(d: DispElPtr);
PROCEDURE CursorOff(d: DispElPtr);
PROCEDURE Position(d: DispElPtr; x, y: INTEGER);
PROCEDURE Plain(d: DispElPtr);
PROCEDURE UnderLinedOn(d: DispElPtr);
PROCEDURE UnderLinedOff(d: DispElPtr);
PROCEDURE BoldOn(d: DispElPtr);
PROCEDURE BoldOff(d: DispElPtr);
PROCEDURE ItalicOn(d: DispElPtr);
PROCEDURE ItalicOff(d: DispElPtr);
PROCEDURE Home(d: DispElPtr);
PROCEDURE ClrHome(d: DispElPtr);
PROCEDURE ScrollUp(d: DispElPtr);
PROCEDURE ScrollUpN(d: DispElPtr; n: INTEGER);
PROCEDURE ScrollDown(d: DispElPtr);
PROCEDURE ScrollDownN(d: DispElPtr; n: INTEGER);
PROCEDURE InsertLine(d: DispElPtr; n: INTEGER);
PROCEDURE DeleteLine(d: DispElPtr; n: INTEGER);
PROCEDURE WriteLn(d: DispElPtr);
PROCEDURE Write(d: DispElPtr; Str: ARRAY OF CHAR);

END Display.

